home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 24
/
Aminet 24 (1998)(GTI - Schatztruhe)[!][Apr 1998].iso
/
Aminet
/
util
/
boot
/
IfNoDrive.lha
/
IfNoDrive.e
< prev
next >
Wrap
Text File
|
1998-02-08
|
1KB
|
55 lines
MODULE 'dos/dos', 'dos/dosextens'
PROC main()
DEF drive_present, reboot, delay, args:PTR TO LONG, rdargs,
drive_name[100]:ARRAY OF CHAR, dos_list:PTR TO doslist,
flags
IF rdargs:=ReadArgs('DEVICE/A,REBOOT/S,DELAY/N', args:=[NIL, FALSE, 0]:LONG, NIL)
AstrCopy(drive_name, args[0], 100)
reboot:=(args[1]<>NIL)
delay:=Long(args[2]) * TICKS_PER_SECOND
IF delay<0 THEN delay:=0; IF delay>1000 THEN delay:=1000
FreeArgs(rdargs)
flags:=(LDF_READ OR LDF_ALL)
IF (dos_list:=LockDosList(flags))
drive_present:=FindDosEntry(dos_list, drive_name, LDF_ALL)
UnLockDosList(flags)
IF (drive_present=FALSE)
IF reboot; Delay(delay); ColdReboot(); ENDIF
RETURN 5
ENDIF
ELSE
RETURN 10
ENDIF
ELSE
WriteF('Bad/missing arguments. Type \aIfNoDrive ?\a for the command template.\n')
RETURN 20
ENDIF
ENDPROC
CHAR '$VER: IfNoDrive 0.7 (8.2.98)\0'